Overview

imaG is a custom control for use with Microsoft Visual Basic 6.0 .

This control is an upgrade of the old PictureX adapted to all VGA cards.

This control is in some ways similar to the standard Visual Basic Picture Box control. Either control can be used to display a graphic in your application. But the imaG control can handle images with up to 24-bit color and has additional special properties which make it easy to load, display, output, resize and process your graphics. imaG is also an extensive set of powerful methods which allows you to program advanced graphics capabilities into your applications.

See also Working Modes , Colors & Palettes , Supported Files , The Undo Buffer , Distributing Applications

Copyright © Carlos Acerbi


Working Modes

imaG can work basically in two modes: DRAW and EDIT.

In Draw mode imaG works like a PictureBox. You can draw lines, rectangles, points circles, etc ...

In Edit mode you can draw figures into the display by mooving the mouse across it.

DRAW MODE METHODS:

Brightness | Cls | Contrast | DrawCircle
DrawLine | DrawPoint | DrawString | Gamma
GetPalette | GetScanLine | GrayScale | Invert
LoadPicture | Mirror | PaintPicture | Picture
Point | Rotate | SavePicture | SetPalette
SetScanLine | Sharpen | Soften | Filter

With MODE <> caModeDraw , an ERROR will be thrown.

EDIT MODE METHODS:

SelectAll

With MODE = caModeDraw , an ERROR will be thrown.

PROPERTY MODE:

imaG.Mode = caMode...

Constant values to work in DRAW mode

caModeDraw

Constant values to work in EDIT mode

caModeEditSelection | caModeEditPen | caModeEditBrush
caModeEditEraser | caModeEditFill | caModeEditLine
caModeEditRectangle | caModeEditRectangleFilled | caModeEditRoundRectangle
caModeEditRoundRectangleFilled | caModeEditEllipse | caModeEditEllipseFilled

For changing the working mode, change the property MODE from caModeDraw to caModeEdit...

Copyright © Carlos Acerbi


Colors & Palettes

What Is a True Color Image ?

A True Color image is a type of image that mixes shades of red, green, and blue to provide over 16 million colors. These color images are also known as RGB24 images.

What Is a Palettized Image ?

A palette is a look-up table that is used to translate an index value into a color value (known as an RGB value).
Color images are often stored using a palette so that they take up less space. Such an image is said to be palettized. A complex image that has been palettized is often of lower quality than the original image. This is due to the fact that the eye can distinguish many more colors than are usually available in the palette.

Pixels

The pixel is the smallest graphic unit on a screen or image. It is equal to one screen dot.

Color Depth

A true color image stores the image info in units of 24 bit per pixel ( 8 for Red, 8 for green, 8 for blue).

A 256 color palettized image stores the image info in:

  • a section of 256 color info, named palette
  • units of 8 bit per pixel (index value of the palette).

A 16 color palettized image stores the image info in:

  • a section of 16 color info, named palette
  • units of 4 bit per pixel (index value of the palette).

A 2 color palettized image stores the image info in:

  • a section of 2 color info, named palette
  • units of 1 bit per pixel (index value of the palette).

The Color Depth of an image is the number of bits per pixel used to display and store an image

Changing the ColorDepth property, changes the color depth of de image.

ColorDepth Constants.

caRGB = 24 | caPal256 = 8
caPal16 = 4 | caPal2 = 1

Properties and methods.

Some properties and methods change the structure of the original palette, if you are working in palettized mode:

Brightness | ColorDepth | Contrast
Gamma | GrayScale | Invert
SetPalette | SetPalColor | Filter

Copyright © Carlos Acerbi


Supported Files

imaG CAN LOAD AND SAVE THE FOLLOWING FILES

File Description | Constant
BMP | caFileBmp = 0
GIF | caFileGif = 1
JPG | caFileJpg = 2
TIF | caFileTif = 4 [If Imaging for Windows (Copyright © Kodak, 1995-1997) is present]

FILES AND IMAGES

Comp = Compression - Trans = Transparent

File Description | Image | Comp | Trans
BMP | TRUE COLOR IMAGE - PALETTIZED IMAGE | NO | NO
GIF | PALETTIZED IMAGE | AUTO | YES
JPG | TRUE COLOR IMAGE | YES | NO
TIF | TRUE COLOR IMAGE - PALETTIZED IMAGE | AUTO | NO

COMPRESSION AND TRANSPARENT

When saving a Jpg file you can specify the compression level.
COMPRESSION LEVEL : 1 to 100

When saving a Gif file you can specify the transparent color.

Available Transparent Color Constants
caGifTransparentNone = -1
caGifTransparentBlack = &H0&
caGifTransparentWhite = &HFFFFFF
caGifTransparentGray = &HC0C0C0
caGifTransparentRed = &HFF&
caGifTransparentBlue = &HFF0000
caGifTransparentYellow = &HFFFF&

ERRORS

If you are NOT in caModeDraw MODE, an ERROR will be thrown.

When saving a Gif file from a non palettized image, an ERROR will be thrown.


The Undo Buffer

The imaG control has four UNDO/REDO buffers, two for DRAW MODE and two for EDIT MODE.

The depth of the buffers depends of the size of the image (4 to 8).

In EDIT MODE the buffer is automatically set.

UNDO/REDO ACTIONS IN EDIT MODE | CONSTANTS
Pen | caUndoPen = 1
Brush | caUndoBrush = 2
Eraser | caUndoEraser = 3
Fill | caUndoFill = 4
Line | caUndoLine = 5
Rectangle | caUndoRectangle = 6
Filled Rectangle | caUndoRectangleFilled = 7
Round Rectangle | caUndoRoundRectangle
Filled Round Rectangle | caUndoRoundRectangleFilled = 9
Ellipse | caUndoEllipse = 10
Filled Ellipse | caUndoEllipseFilled = 11
Cut | caUndoCut = 12
Paste | caUndoPaste = 13
Delete | caUndoDelete = 14

In DRAW MODE the buffer is automatically set for some actions and is also programmable.

UNDO/REDO ACTIONS IN DRAW MODE | CONSTANTS
Cut | caUndoCut = 12
Paste | caUndoPaste = 13
Delete | caUndoDelete = 14
Draw Line | caUndoDrawLine = 15
Draw Text | caUndoDrawText = 16
Draw Point | caUndoDrawPoint = 17
Draw Circle | caUndoDrawCircle = 18
Mirror Horizontal | caUndoMirror = 19
Mirror Vertical | caUndoFlip = 20
Rotate 180º | caUndoRotateDown = 21
Edit | caUndoEdit = 22

When the imaG is turned to EDIT MODE the image (in DRAW MODE) is saved to the buffer.

The DRAW MODE Buffer will be cleared when changing the color depth.
The DRAW MODE Buffer will be cleared when changing the size of the image (Rotate +- 90º , ...)

The EDIT MODE Buffer will be cleared when turning from edit mode to draw mode.

With the Test property set to TRUE , all the UNDO/REDO actions will NOT effective to avoid large memory spaces.

PROGRAMMING THE UNDO BUFFER.

In DRAW MODE the UNDO/REDO buffer is programmable.

Before the image changes :

imaG.Undo_Add UndoName

After the image changes

PctureX.Undo_AddPalette (saves the redo palette)

UNDO-REDO ACTION.

imaG.Undo_Query (parameters ...) - presets the Undo/Redo buffer and returns the undo/redo values for recognizing the action

imaG.Undo_Undo or
imaG.Undo_Redo

Copyright © Carlos Acerbi


Distributing Image Applications

When distributing your image applications, you have to include the following files:

caTimer.dll
caBtm.dll
ijl10.dll (for enabling jpg files)

and the control:

caPicX.ocx

For working with TIFF files you need to make sure that Imaging for Windows (Copyright © Kodak, 1995-1997) is present in the oparating system.

Copyright © Carlos Acerbi


Contact us ...

Some interesting links ...

IF YOU NEED HELP

Please contact with our Support Department.

IF YOU WISH PRICES INFORMATION

Please contact with our Sales Department.

IF YOU NEED TO REPORT BUGS

Please contact with our Support Department.

FOR MORE INFORMATION

Please visit our Web International E-Software Associates.


Appearance

Returns ad sets the appearance of the imaG window.

Syntax: | imaG.Appearance = appearance (constant)
Constants: | caAppearanceConstants

Default Value: 0 Flat

This is a standard Microsoft Visual Basic property.


AutoSize

Determines if the imaG window is automatically resized to fit the image size.

Syntax: imaG.AutoSize = TRUE|FALSE

Default Value: TRUE


BackColor

Returns and sets the background color used by the imaG for displaying images and drawing.

Syntax: imaG.BackColor = color (OLE_COLOR)

Default Value: &H8000000F (ButtonFace)

This color will appear in areas of the imaG control on the screen that are not filled by the image.

If you are using this property with a palettized image, then the color selected must be contained in the image's palette. If it is not, then the closest color found in the image's palette is used.


BorderStyle

Returns and sets the border style for the imaG window.

Syntax: | imaG.BorderStyle = borderstyle (constant)
Constants: | caBorderStyleConstants

Default Value: 0 None

This is a standard Microsoft Visual Basic property.


ColorCount

Returns information of the imaG image color at a specific color count mode.

Syntax: | imaG.ColorCount (mode , color)
mode | See caColorCountModeConstants
color (OLE_COLOR) | OPTIONAL - Determines the color in the image to obtain the information.
Returns: (long) | Color information.

MODE

caColorCountColor = 0 with color = -1 | Counts the number of colors in a imaG's image.
caColorCountColor = 0 with color = OLE_COLOR | Counts the number of times the color value is used in a imaG's image at a specific color value.
caColorCountMax = 1 | Counts the maximum number of times a color is used in a PicctureX's image and returns the color value.
caColorCountMin | Counts the minimum number of times a color is used in a imaG's image and returns the color value.

See also ColorDepth , Color & Palettes , GetPalColorCount


ColorDepth

This property returns and sets the color depth (in bits per pixel 1, 4, 8, or 24) of the imaG image.

Syntax: | imaG.ColorDepth = colordepth (constant)
Constants: | caColorDepthConstants

The DRAW MODE UNDO/REDO Buffers will be cleared.

See also ColorCount , Color & Palettes , GetPalColorCount


CurrentX

Specifies the horizontal coordinate for the next graphic method.

Syntax: | imaG.CurrentX = x
x (single) | horizontal coordinate

The value of x depends on the value of ScaleWidth, ScaleLeft, and ScaleMode.

CurrentX makes sense with MODE = caModeDraw.


CurrentY

Specifies the vertical coordinate for the next graphic method.

Syntax: | imaG.CurrentY = y
y (single) | vertical coordinate

The value of y depends on the value of ScaleHeight, ScaleTop and ScaleMode.

CurrentY makes sense with MODE = caModeDraw.


DrawStyle

This property returns and sets a value that determines the line style for output from a graphics method in the imaG window when working in DRAW mode.

Syntax: | imaG.DrawStyle = drawstyle (constant)
Constants: | vbSolid = 0 ; vbDash = 1

Default Value: 0 vbSolid

This is a standard Microsoft Visual Basic property.

The constant meaning is described in the Microsoft Visual Basic Help.

See also DrawCircle , DrawLine , DrawMode , DrawPoint , DrawString , DrawWidth


DrawMode

This property returns and sets a value that determines the appearance of output from a graphics method in the imaG window when working in DRAW mode.

Syntax: | imaG.DrawMode = drawmode (constant)
Constants: | Microsoft Visual Basic DrawModeConstants

Default Value: 13 vbCopyPen

This is a standard Microsoft Visual Basic property.

The constant meaning is described in the Microsoft Visual Basic Help.

See also DrawCircle , DrawLine , DrawPoint , DrawString , DrawStyle , DrawWidth


DrawWidth

This property returns and sets the line width for output from a graphics method in the imaG window when working in DRAW mode.

Syntax: | imaG.DrawWidth = drawwidth
drawwidth (integer) | This value represents the width of the line in pixels.

Default Value: 1 pixel wide

This is a standard Microsoft Visual Basic property.

See also DrawCircle , DrawLine , DrawMode , DrawPoint , DrawString , DrawStyle , EditLineWidth


EditColorRight

When working in EDIT mode this property returns and sets the color used to draw shapes of ellipses and boxes created by pressing the right button of the mouse.

When working in DRAW mode this property is not effective.

Syntax: | imaG.EditColorRight = color
color (OLE_COLOR) | Value or constant that determines the edit color.

Default Value: &HFFFFFF White

If you are using this property with a palettized image, then the color selected must be contained in the image's palette. If it is not, then the closest color found in the image's palette is used.

See also FillColor , FillStyle , ForeColor


EditLineWidth

This property returns and sets the line width for output from a graphics method in the imaG window when working in EDIT mode.

Syntax: | imaG.EditLineWidth(mode) = width
mode (constant) | caDrawWidthConstants (This value represents the shape selected - line, rectangle, ...)
width (integer) | This value represents the width of the line in pixels.

Default Values:

1 for Pen
2 for Brush
1 for Line
1 for Rectangle and Ellipse
4 for Eraser

See also Draw Width


Enabled

Determines if the imaG window will respond to user-generated events.

Syntax: imaG.Enabled = TRUE|FALSE

Default Value: TRUE

This is a standard Microsoft Visual Basic property.


FillColor

When working in DRAW mode this property returns and sets the color used to fill in circles and boxes created with the DrawCircle and DrawLine graphics methods.

When working in EDIT mode this property returns and sets the color used to fill in circles and boxes created with MODE = (caModeEditRectangleFilled , caModeEditRoundRectangleFilled , ModeEditEllipseFilled , caModeEditFill).

Syntax: | imaG.FillColor = color
color (OLE_COLOR) | Value or constant that determines the fill color.

Default Value: 0 black

This is a standard Microsoft Visual Basic property.

If you are using this property with a palettized image, then the color selected must be contained in the image's palette. If it is not, then the closest color found in the image's palette is used.

See also FillStyle , ForeColor , EditColorRight


FillStyle

When working in DRAW mode this property returns and sets the pattern used to fill circles and boxes created with the DrawCircle and DrawLine graphics methods.

When working in EDIT mode this property is NOT effective.

Syntax: | imaG.FillStyle = style (constant)
Constants: | Microsoft Visual Basic FillStyleConstants .

Default Value: 0 vbFSSolid

This is a standard Microsoft Visual Basic property.

The constant meaning is described in the Microsoft Visual Basic Help.

See also FillColor , ForeColor , EditColorRight


Font

This property returns and sets the font used to draw text created with the DrawText method, when working in DRAW mode.

Syntax: | Set imaG.Font = font
font (StdFont) | Object that determines the font.

Default Value: Ambient.Font

This is a standard Microsoft Visual Basic property.


ForeColor

When working in DRAW mode this property returns and sets the foreground color used to display text and shapes created with graphics methods.

When working in EDIT mode this property returns and sets the color used to draw shapes of ellipses and boxes created by pressing the left button of the mouse.

Syntax: | imaG.ForeColor = color
color (OLE_COLOR) | Value or constant that determines the fore color.

Default Value: &H80000012 ButtonText

This is a standard Microsoft Visual Basic property.

If you are using this property with a palettized image, then the color selected must be contained in the image's palette. If it is not, then the closest color found in the image's palette is used.

See also FillColor , FillStyle , EditColorRight


hDc

This property returns a handle provided by Windows to the device context of the imaG object.

Syntax: | imaG.hDc
Returns: (long) | Device context handle

This is a standard Microsoft Visual Basic property.


hWnd

When working in DRAW mode, this property returns a window handle provided by Windows to the imaG draw display.

When working in EDIT mode, this property returns a window handle provided by Windows to the imaG edit display.

Syntax: | imaG.hWnd
Returns: (long) | Window handle

This is a standard Microsoft Visual Basic property.


ImageHeight

Returns the height (in twips) of the imaG image.

Syntax: | imaG.ImageHeight
Returns: (long) | The image height value.


ImageResolutionX

Returns the width (in pixels) of the imaG image.

Syntax: | imaG.ImageResolutionX
Returns: (long) | The image width value.


ImageResolutionY

Returns the height (in pixels) of the imaG image.

Syntax: | imaG.ImageResolutionY
Returns: (long) | The image height value.


ImageWidth

Returns the width (in twips) of the imaG image.

Syntax: | imaG.ImageWidth
Returns: (long) | The image width value.


Mode

This property returns and sets the WORKING MODE of imaG.

Syntax: | imaG.Mode = mode (constant)
Constants: | caModeConstants
 | caModeDraw = 0 caModeEditPen = 1 caModeEditBrush = 2 caModeEditEraser = 3 caModeEditFill = 4 caModeEditLine = 5 caModeEditRectangle = 6 caModeEditRectangleFilled = 7 caModeEditRoundRectangle = 8 caModeEditRoundRectangleFilled = 9 caModeEditEllipse = 10 caModeEditEllipseFilled = 11 caModeEditSelection = 12

If no picture is in the control and an edit mode is selected then an ERROR will be thrown.

See WORKING MODES .


MouseIcon

When working in DRAW mode, this property returns and sets the icon of the mouse of a imaG object.

When working in EDIT mode, this property is not effective.

Syntax: | imaG.MouseIcon mouseicon
mouseicon (IPictureDisp) | The custom Picture Object

This is a standard Microsoft Visual Basic property.


MousePointer

When working in DRAW mode, this property returns and sets the mouse pointer of a imaG object.

When working in EDIT mode, this property is not effective.

Syntax: | imaG.MousePointer mousepointer (constant)
Constants: | Microsoft Visual Basic MousePointerConstants

This is a standard Microsoft Visual Basic property.


Picture

This property returns and sets a graphic in the imaG object.

The previous graphics in the control (pictures and images) will be erased.

The Undo/Redo buffer will be reset.

Syntax: | imaG.Picture = picture
picture (IPictureDisp) | The picture.

This is a standard Microsoft Visual Basic property.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.


Redraw

Returns and sets the boolean value that determines if the imaG window is automatically shown when the imaG image changes (in Draw Mode only).

This property is useful when many actions have to be performed to increase the speed and to avoid image's blinks.

Syntax: imaG.Redraw = TRUE|FALSE

Default Value: TRUE

See QueryAction , Test


ScaleHeight

When working in DRAW mode this property returns the height of the rectangular area used to draw in the imaG.

When working in EDIT mode this property is NOT effective.

Syntax: | imaG.ScaleHeight
Returns: (single) | The height of the rectangular area.

This is a standard Microsoft Visual Basic property.


ScaleMode

This property determines the measure unit of the rectangular area used to draw in the imaG.

When working in EDIT mode this property is NOT effective.

Syntax: | imaG.ScaleMode = unit (constant)
Constants: | Microsoft Visual Basic ScaleModeConstants.

Default Value: 1 Twip

This is a standard Microsoft Visual Basic property.


ScaleWidth

When working in DRAW mode this property returns the width of the rectangular area used to draw in the imaG.

When working in EDIT mode this property is NOT effective.

Syntax: | imaG.ScaleWidth
Returns: (single) | The width of the rectangular area.

This is a standard Microsoft Visual Basic property.


Test

Returns and sets the boolean value that determines if the imaG is in TEST MODE.

Syntax: imaG.Test = TRUE|FALSE

Default Value: FALSE

When working in DESIGN MODE (Microsoft Visual Basic Editor) some actions can throw unexpected errors. To avoid this errors imaG must be turned to TEST MODE.

In TEST MODE the speed is reduced and de Undo/Redo methods are locked.

Do not forget to set the Test property to FALSE when creating your EXE file.

See QueryAction , Redraw


TextHeight

This property returns the height of a text string for output from DrawString method, in accordance with the current imaG.Font .

Syntax: | imaG.TextHeight
Returns: (single) | The value of the height of the string.

This is a standard Microsoft Visual Basic property.


TextWidth

This property returns the width of a text string for output from DrawString method, in accordance with the current imaG.Font .

Syntax: | imaG.TextWidth
Returns: (single) | The value of the width of the string.

This is a standard Microsoft Visual Basic property.


Zoom

Returns and sets the zoom value of a imaG image.

Syntax: | imaG.Zoom zoom
zoom (single) | The factor by which to increase or decrease the size of the zoomed image; use 1 to view the real size, 2 for double size, 0.50 for half size, and so on

If you are NOT in caModeDraw MODE, zoom values < 1 will NOT effective.


CanPaste

Determines whether image is present in the Clipboard.

Syntax: | imaG.CanPaste
Returns: (boolean) | True : Image is in the clipboard False : Image is NOT in the clipboard

Use the CanPaste method to determine whether the Paste method can be invoked.

See also Cut , Copy , Paste


Cls

Clears a displayed image in the imaG.

Syntax: | imaG.Cls
Returns: | (empty)

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.


Contrast

Adjusts the contrast of a imaG image.

Syntax: | imaG.Contrast contrast
contrast (integer) | The factor by which to increase or decrease the contrast of the image; use 0 for no contrast, 100 for maximum, 50 to cause no change.

If the imaG contains a palettized image, then the palette is adjusted.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Brigtness , Gamma , Filter , GrayScale


Copy

Copies the image contained in the imaG to the Windows' clipboard.

Syntax: | imaG.Copy
Returns: | (empty)

If MODE PROPERTY is caModeEditSelection , current selection area is copied to the Windows' clipboard, else the imaG's entire image is copied to the Window's clipboard.

See also CanPaste , Cut , Paste


Cut

Copies the image contained in the imaG to the Windows' clipboard. The source image will be deleted.

Syntax: | imaG.Cut
Returns: | (empty)

If MODE PROPERTY is caModeEditSelection , current selection area is copied to the Windows' clipboard, else the imaG's entire image is copied to the Window's clipboard.
The source image will be deleted.

See also CanPaste , Copy , Paste


DrawCircle

Draws a circle, ellipse or arc on an image.

Syntax: | imaG.DrawCircle x , y , radius , color , startpos , endpos , aspect
x (single) | The beginning horizontal position of the center point.
y (single) | The beginning vertical position of the center point.
radius (single) | radius of the circle
color (OLE_COLOR) | OPTIONAL - color of the circle (default : imaG.ForeColor)
startpos (single) | OPTIONAL - start position of the arc (default : 0)
endpos (single) | OPTIONAL - end position of the arc (default : 2 * pi)
aspect (single) | OPTIONAL - ellipse radius ralation (default : 1.0 - circle)

This is a standard Microsoft Visual Basic method.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

If you are using this method with a palettized image, then the color selected must be contained in the image's palette. If it is not, then the closest color found in the image's palette is used.

See also DrawCircle , DrawLine , DrawMode , DrawPoint , DrawString , DrawStyle , DrawWidth


DrawLine

Draws a line or rectangle on an image.

Syntax: | imaG.DrawLine x1 , y1 , x2 , y2 , color , rectangle , fill
x1 (single) | The beginning horizontal position of the starting point.
y1 (single) | The beginning vertical position of the starting point.
x2 (single) | The beginning horizontal position of the ending point.
y2 (single) | The beginning vertical position of the ending point.
color (OLE_COLOR) | OPTIONAL - color of the line or rectangle (default : imaG.ForeColor)
rectangle (boolean) | OPTIONAL - a rectangle will be drawn instead a line (default : false)
fill (boolean) | OPTIONAL - if rectangle = true then the internal area will be filled using fill criteria of imaG (default : false)

This is a standard Microsoft Visual Basic method.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

If you are using this method with a palettized image, then the color selected must be contained in the image's palette. If it is not, then the closest color found in the image's palette is used.

See also DrawCircle , DrawMode , DrawPoint , DrawString , DrawStyle , DrawWidth


DrawPoint

Draws a point on an image.

Syntax: | imaG.DrawPoint x , y , color
x (single) | The beginning horizontal position of the point.
y (single) | The beginning vertical position of the point.
color (OLE_COLOR) | OPTIONAL - color of the point (default : imaG.ForeColor)

This is a standard Microsoft Visual Basic method.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

If you are using this method with a palettized image, then the color selected must be contained in the image's palette. If it is not, then the closest color found in the image's palette is used.

See also DrawCircle , DrawLine , DrawMode , DrawString , DrawStyle , DrawWidth


DrawString

Draws a string of characters on an image.

Syntax: | imaG.DrawString string , x , y , color , font
string | The text to draw
x (single) | OPTIONAL - The beginning horizontal position of the starting point. (default : imaG.CurrentX)
y (single) | OPTIONAL - The beginning vertical position of the starting point. (default : imaG.CurrentY)
color (OLE_COLOR) | OPTIONAL - color of the text (default : imaG.ForeColor)
font (StdFont) | OPTIONAL - font of the text (default : imaG.Font)

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

If you are using this method with a palettized image, then the color selected must be contained in the image's palette. If it is not, then the closest color found in the image's palette is used.

See also DrawCircle , DrawLine , DrawMode , DrawPoint , DrawStyle , DrawWidth


Filter

Loads a filter and replaces the image of the imaG with an image that has been dithered to the filter. If the image is a palettized image and the imaG palette do not contain some filter's color, the closest colors of the palette are used .

Syntax: | imaG.Filter redarray() , greenarray() , bluearray()
redarray() (integer array) | The redarray must be in the range 0 - 255 and contains 256 values for reds.
greenarray() (integer array) | The greenarray must be in the range 0 - 255 and contains 256 values for greens.
bluearray() (integer array) | The bluearray must be in the range 0 - 255 and contains 256 values for blues.

WORKING MODE

X is a pixel in the imaG's image and the color values for X are r , g , b in the range 0 - 255 .
The filter will replace the values r , g , b with the values of redarray(r) , greenarray(g) , bluearray(b).
And so on for each pixel in the imaG's image ...

If the imaG's image is a palettized image, ensure that the filter colors are in the palette or the closest colors of the palette will be used.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Brightness , Contrast , Gamma , GrayScale


Gamma

Adjusts the gamma of a imaG image.

Syntax: | imaG.Gamma gamma
gamma (integer) | The factor by which to increase or decrease the gamma-correction of the image; use 0 ... 500 to reduce gamma correction, 500 ... 1000 to increase gamma correction (500 causes no change)

If the imaG contains a palettized image, then the palette is adjusted.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Brigtness , Contrast , Filter , GrayScale


GetPalColor

Returns the RGB color of the imaG palette at a specific palette index.

Syntax: | imaG.GetPalColor (index)
index (long) | Specifies the index in the palette to obtain the color value from. Must be in the range 0-255 ; 0-15 ; 0-1 for a color depth 8 ; 4 ; 1
Returns: (OLE_COLOR) | Color value.

If the image is a true color image (24 bit per pixel depth), an ERROR will be thrown.

See also Color & Palettes , SetPalColor , GetPalette , SetPalette


GetPalColorCount

Returns information of the imaG palette at a specific color count mode.

Syntax: | imaG.GetPalColorCount (mode , index)
mode | See caColorCountModeConstants
index (integer) | OPTIONAL - Determines the index in the palette to obtain the information. Must be in the range 0-255 ; 0-15 ; 0-1 for a color depth 8 ; 4 ; 1
Returns: (long) | Color information.

MODE

caColorCountColor = 0 | Counts the number of times a palette color is used in a imaG's at a specific palette index.
caColorCountMax = 1 | Counts the maximum number of times a palette color is used in a PicctureX's and returns the color value.
caColorCountMin = 2 | Counts the minimum number of times a palette color is used in a imaG's and returns the color value.

If the image is a true color image (24 bit per pixel depth), an ERROR will be thrown.

See also ColorCount , ColorDepth , Color & Palettes


GetPalette

Obtains the palette information from the imaG palette and places it into an array.

Syntax: | imaG.GetPalette (palette())
palette() (long array) | The array to put the imaG's current palette into. Each element of the array will contain one palette entry in RGB format.
Returns: (boolean) | TRUE if is a palettized image - FALSE if is a true color image.

The palette array must be defined without dimensions, with the statment : Dim|Private|Public palette() As Long

See also Color & Palettes , GetPalColor , SetPalColor , SetPalette


GetScanLine

This method obtains a single scan line from the imaG image and places the data into an array.

Syntax: | imaG.GetScanLine nline , colorarray()
nline (long) | Indicates which scan line of the image to obtain. Must be in the set [0 ... imaG.ImageResolutionY] .
colorarray() (long array) | Contains the scan line’s pixel data. The number of elements needed for the array is equal to imaG.ImageResolutionX.

The colorarray must be defined without dimensions with the statment : Dim|Private|Public array() As Long .

See also SetScanLine


GrayScale

Converts the imaG image to a grayscale image.

Syntax: imaG.GrayScale

If the imaG contains a palettized image, a new palette will be created with a scale of gray colors.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Brightness , Contrast , Gamma , Filter


Invert

This method negates the imaG image.

Syntax: imaG.Invert

This method changes all colors to their opposites in RGB color space. Black becomes white, white becomes black, yellow becomes blue, blue becomes yellow, etc.

If the imaG contains a palettized image, a new palette will be created with inverted colors.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Mirror , Rotate , Sharpen , Soften


LoadPicture

Loads an image from an image document file to the imaG.

Syntax: | imaG.LoadPiture path
path (string) | The path of the image document file.
Returns: | TRUE if the action was concluded - FALSE if an error occur.

SUPPORTED FILE TYPES

File Description | Constant
BMP | caFileBmp = 0
GIF | caFileGif = 1
JPG | caFileJpg = 2
TIF | caFileTif = 3 (Win98 or higher with imgedit.ocx)

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See Supported Files , SavePicture


Mirror

Flips the imaG image horizontally or vertically.

Syntax: | imaG.Mirror mode
mode (constant) | caMirrorConstants (This value determines the flipping direction (horizontally or vertically).

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Invert , Rotate , Sharpen , Soften


PaintPicture

Paints a picture on an image.

Syntax: | imaG.PaintPicture picture , x1 , y1 , width1 , height1 , x2 , y2 , width2 , height2 , opcode
picture (IPictureDisp) | The picture to be painted
x1 (single) | The beginning horizontal position of the destination starting point.
y1 (single) | The beginning vertical position of the destination starting point.
width1 (single) | OPTIONAL - Destination image width (deafault : source image width)
height1 (single) | OPTIONAL - Destination image height (deafault : source image height)
x2 (single) | OPTIONAL - The beginning horizontal position of the source starting point (default : 0).
y2 (single) | OPTIONAL : The beginning vertical position of the source starting point (default : 0).
width2 (single) | OPTIONAL - Source image width (deafault : whole source image width)
height2 (single) | OPTIONAL - Sorce image height (deafault : whole source image height)
opcode (long) | OPTIONAL - RasterOpConstants (default : 13)

This is a standard Microsoft Visual Basic method.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

If you are using this method with a palettized image, then all the colors in the picture must be contained in the image's palette. If it is not, then the closest colors in the image's palette are used.


Paste

Pastes an image from the Windows' clipboard into the imaG.

Syntax: | imaG.Paste x , y
x (single) | OPTIONAL - horizontal coordinate (default = 0)
y (single) | OPTIONAL - vertical coordinate (default = 0)

If MODE PROPERTY is caModeEditSelection , the image is pasted in the current selection area.

If MODE PROPERTY is caModeDraw , the image is pasted in the origin x , y .

See also CanPaste , Cut , Copy


Point

This method returns the RGB color of a point in the imaG object.

Syntax: | imaG.Point x , y
x (single) | The horizontal position of the point.
y (single) | The vertical position of the point.
Returns: (OLE_COLOR) | The RGB color of the pixel

This is a standard Microsoft Visual Basic method.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.


QueryAction

This method returns several values that determine if a new action is available.

Syntax: | imaG.QuaryAction draw , edit , selectall , cutpaste
draw (boolean) | ByRef argument that determines if draw actions are available.
edit (boolean) | ByRef argument that determines if edit actions are available.
selectall (boolean) | ByRef argument that determines if select all action is available.
cutpaste (boolean) | ByRef argument that determines if cut or paste action is available.

DRAW ACTIONS (methods and properties)

Brightness | Cls | Contrast | DrawCircle
DrawLine | DrawPoint | DrawString | Gamma
GetPalette | GetScanLine | GrayScale | Invert
LoadPicture | Mirror | PaintPicture | Picture
Point | Rotate | SavePicture | SetPalette
SetScanLine | Sharpen | Soften | Filter

SELECT ALL ACTIONS (methods)

SelectAll

CUT PASTE ACTIONS (methods)

Cut Paste

See Redraw , Test


Refresh

This method redraws the complete imaG object.

Syntax: | imaG.Refresh
Returns: | (empty)

This is a standard Microsoft Visual Basic method.


Rotate

Rotates the imaG image and the Display window also.

Syntax: | imaG.Rotate mode
mode (constant) | caRotateConstants (This value determines the rotation angle (90º , 180º , 270º).

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

All the UNDO/REDO buffers will be cleared.

See also Invert , Mirror , Sharpen , Soften


SavePicture

Saves an image to an image document file.

Syntax: | imaG.SavePiture path , saveas , compression , colortransparent
path (string) | The path of the image document file.
saveas (constant) | The file type constant ( caFileConstants )
compression (integer) | OPTIONAL : The factor by which to increase or decrease the compression of the image in a JPG file; use 1 for no compression, 100 for maximum.
colortransparent (constant) | OPTIONAL : The value ( caGifTransparentConstants ) that determines the transparent color in a GIF file.
Returns: | TRUE if the action was concluded - FALSE if an error occur.

When saving a Gif file from a true color image, an ERROR will be thrown.

FILE TYPE CONSTANTS

File Description | Constant
BMP | caFileBmp = 0
GIF | caFileGif = 1
JPG | caFileJpg = 2
TIF | caFileTif = 3 (Win98 or higher with imgedit.ocx)

COMPRESSION AND TRANSPARENT

When saving a Jpg file you can specify the compression level.
COMPRESSION LEVEL : 1 to 100

When saving a Gif file you can specify one transparent color.

Available Transparent Color Constants
caGifTransparentNone = -1
caGifTransparentBlack = &H0&
caGifTransparentWhite = &HFFFFFF
caGifTransparentGray = &HC0C0C0
caGifTransparentRed = &HFF&
caGifTransparentBlue = &HFF0000
caGifTransparentYellow = &HFFFF&

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See Supported Files , LoadPicture


SelectAll

When working in EDIT MODE this method will select the whole imaG image.

Syntax: | imaG.SelectAll
Returns: | (empty)

If the imaG Mode is NOT caModeEditSelection, an ERROR will be thrown.


SetImageFromPalette

Refreshs the current image according to the colors of tthe current palette.

Syntax: | imaG.SetImageFromPalette
Returns: | (empty)

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also SetPaletteFromImage , Soften , Sharpen


SetPalColor

Sets the RGB color of the imaG palette at a specific palette index.

Syntax: | imaG.SetPalColor index , color
index (long) | Specifies the index in the palette to set the color value. Must be in the range 0-255 ; 0-15 ; 0-1 for a color depth 8 ; 4 ; 1
color (OLE_COLOR) | Color value.

If the image is a true color image (24 bit per pixel depth), an ERROR will be thrown.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Color & Palettes , GetPalColor , GetPalette , SetPalette


SetPalette

Loads a new palette and replaces the image of the imaG with an image that has been dithered to the new palette (the closest colors in the image's palette are used) .

Syntax: | imaG.SetPalette (mode , palette())
mode (constant) | See caPalModeConstants
palette() (long array) | OPTIONAL - The array to define the new palette. Each element of the array will contain one palette entry in RGB format.
Returns: | (empty)

The palette array must be defined with dimensions, with the statment : Dim|Private|Public palette(x To y) As Long . The array dimensions will be:

(0 To 1) for a Depth of 1 bit per pixel
(0 To 15) for a Depth of 4 bit per pixel
(0 To 255) for a Depth of 8 bit per pixel

MODE

caPalModeCustom = 0 | Sets a custom palette - The palette array must be specified
caPalModeCompact = 1 | Compacts the current palette using only the colors in the image
caPalModeWindows = 2 | Sets the standard windows palette
caPalModeWeb = 3 | Sets the WebSafe palette
caPalModeScaleRed = 4 | Sets a red scale palette
caPalModeScaleGreen = 5 | Sets a green scale palette
caPalModeScaleBlue = 6 | Sets a blue scale palette
caPalModeScaleAqua = 7 | Sets a aqua scale palette
caPalModeScaleMagenta = 8 | Sets a magenta scale palette
caPalModeScaleYellow = 9 | Sets a yelloow scale palette
The image will be dithered to the new palette.

If the image is a true color image (24 bit per pixel depth), an ERROR will be thrown.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Color & Palettes , GetPalColor , SetPalColor , GetPalette


SetPaletteFromImage

Refreshs the current palette according to the colors of tthe current image.

Syntax: | imaG.SetPaletteFromImage
Returns: | (empty)

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also SetImageFromPalette , Soften , Sharpen


SetScanLine

Transfers a line of raw pixel data into the imaG image.

Syntax: | imaG.SetScanLine nline , colorarray()
nline (long) | Indicates which scan line of the image to obtain. Must be in the set [0 ... imaG.ImageResolutionY] .
colorarray() (long array) | Contains the scan line’s pixel data. The number of elements needed for the array is equal to imaG.ImageResolutionX.

The color array must be defined with dimensions, with the statment : Dim|Private|Public colorarray(0 To X) As Long . X = imaG.ImageResolutionX - 1.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also GetScanLine


Sharpen

Sharpens the imaG image using a given sharpness value.

Syntax: | imaG.Sharpen strength
strength (integer) | This value determines the strength of the action. Must be in the range 1 - 10
Returns: | (empty)

If the image is a palettized image, after this action, it should be dithered to the current palette. Use for that: SetPaletteFromImage or SetImageFromPalette .

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Invert , Mirror , Rotate , Soften


Soften

Softens the imaG image using a given softness value.

Syntax: | imaG.Soften strength
strength (integer) | This value determines the strength of the action. Must be in the range 1 - 10
Returns: | (empty)

If the image is a palettized image, after this action, it should be dithered to the current palette. Use for that: SetPaletteFromImage or SetImageFromPalette .

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Invert , Mirror , Rotate , Sharpen


Undo_Add

Saves the current image in the DRAW UNDO/REDO BUFFER with an action name.

Syntax: | imaG.Undo_Add name
name (string) | The string name that will appear when an undo/redo action will be invoked.

This method has to be set before the imaG image changes.

If the imaG is in TEST MODE, this method is not effective.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See The Undo Buffer , UndAdd , UndoAddPalette , UndoQuery , UndoUndo , UndoRedo


Undo_AddPalette

Saves the current image palette in the DRAW REDO BUFFER.

Syntax: | imaG.Undo_AddPalette
Returns: | (empty)

This method has to be set AFTER the imaG image changes to store the REDO palette.

If the image is a true color image (24 bit per pixel depth), this method is not effective.

If the imaG is in TEST MODE, this method is not effective.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See The Undo Buffer , UndAdd , UndoQuery , UndoUndo , UndoRedo


Undo_Query

Prepares the UNDO/REDO BUFFER and returns the next UNDO/REDO values.

Syntax: | imaG.Undo_Query undocaption , undoavailable , redocaption , redoavailable , undokey , redokey
undocaption (string) | Returns the name of the next undo action.
undoavailable (boolean) | Returns the value that determines if an undo action is available.
redocaption (string) | Returns the name of the next redo action.
redoavailable (boolean) | Returns the value that determines if a redo action is available.
undokey (constant) | OPTIONAL - Returns the constant value that recognizes the next undo action. ( caUndoConstants )
redokey (constant) | OPTIONAL - Returns the constant value that recognizes the next redo action. ( caUndoConstants )

All the parameters will be passed ByRef.

If the imaG is in TEST MODE, this method is not effective.

See The Undo Buffer , UndAdd , UndoAddPalette , UndoUndo , UndoRedo


Undo_Redo

Performs a REDO ACTION.

Syntax: | imaG.Undo_Redo
Returns: | (empty)

This method has to be set AFTER an Undo_Query method.

If the imaG is in TEST MODE, this method is not effective.

See The Undo Buffer , UndAdd , UndoAddPalette , UndoQuery , UndoUndo


Undo_Undo

Performs an UNDO ACTION.

Syntax: | imaG.Undo_Undo
Returns: | (empty)

This method has to be set AFTER an Undo_Query method.

If the imaG is in TEST MODE, this method is not effective.

See The Undo Buffer , UndAdd , UndoAddPalette , UndoQuery , UndoRedo


Events

Click()

Occurs when the user presses and then releases a mouse button over the imaG.
Only effective in DRAW mode.

DblClick()

Occurs when the user presses and releases a mouse button and then presses and releases it again over the imaG.
Only effective in DRAW mode.

ImageChange()

Occurs when the graphic contents of the imaG have changed.

KeyDown(KeyCode As Integer, Shift As Integer)

Occurs when the user presses a key while the imaG has the focus.
Only effective in DRAW mode.

KeyPress(KeyAscii As Integer)

Occurs when the user presses and releases an ANSI key while the imaG has the focus.
Only effective in DRAW mode.

KeyUp(KeyCode As Integer, Shift As Integer)

Occurs when the user releases a key while the imaG has the focus.
Only effective in DRAW mode.

MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

Occurs when the user presses the mouse button while the imaG has the focus.
Only effective in DRAW mode.

MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)

Occurs when the user moves the mouse.
Only effective in DRAW mode.

MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

Occurs when the user releases the mouse button while the imaG has the focus.
Only effective in DRAW mode.

UndoChange()

Occurs when the Undo/Redo buffer changes.


Constants

caAppearanceConstants

Flat = 0
ThreeD = 1

caBorderStyleConstants

None = 0
FixedSingle = 1

caColorDepthConstants

caPal2 = 1
caPal16 = 4
caPal256 = 8
caRGB = 24

caColorCountModeConstants

caColorCountColor = 0
caColorCountMax = 1
caColorCountMin = 2

caDrawWidthConstants

caBrushWidth
    = 0
caLineWidth = 1
caRectangleWidth = 2
caEraserWidth = 3

caFileConstants

caFileBmp =
    0
caFileGif = 1
caFileJpg = 2
caFileTif = 3

caGifTransparentConstants

caGifTransparentNone
    = -1
caGifTransparentBlack = &H0&
caGifTransparentWhite = &HFFFFFF
caGifTransparentGray = &HC0C0C0
caGifTransparentRed = &HFF&
caGifTransparentBlue = &HFF0000
caGifTransparentYellow = &HFFFF&

caMirrorConstants

caMirrorHorizontal = 0
caMirrorVertical = 1

caModeConstants

caModeDraw =
    0
caModeEditPen = 1
caModeEditBrush = 2
caModeEditEraser = 3
caModeEditFill = 4
caModeEditLine = 5
caModeEditRectangle = 6
caModeEditRectangleFilled = 7
caModeEditRoundRectangle = 8
caModeEditRoundRectangleFilled = 9
caModeEditEllipse = 10
caModeEditEllipseFilled = 11
caModeEditSelection = 12

caPalModeConstants

caPalModeCustom
    = 0
caPalModeCompact = 1
caPalModeWindows = 2
caPalModeWeb = 3
caPalModeScaleRed = 4
caPalModeScaleGreen = 5
caPalModeScaleBlue = 6
caPalModeScaleAqua = 7
caPalModeScaleMagenta = 8
caPalModeScaleYellow = 9

caRotateConstants

caRotateRight = 90
caRotateLeft = 270
caRotateDown = 180

caUndoConstants

caUndoNothing
    = 0
caUndoPen = 1
caUndoBrush = 2
caUndoEraser = 3
caUndoFill = 4
caUndoLine = 5
caUndoRectangle = 6
caUndoRectangleFilled = 7
caUndoRoundRectangle = 8
caUndoRoundRectangleFilled = 9
caUndoEllipse = 10
caUndoEllipseFilled = 11
caUndoCut = 12
caUndoPaste = 13
caUndoDelete = 14
caUndoDrawLine = 15
caUndoDrawText = 16
caUndoDrawPoint = 17
caUndoDrawCircle = 18
caUndoMirror = 19
caUndoFlip = 20
caUndoRotateDown = 21
caUndoEdit = 22
caUndoCustom = 99


Brightness

Adjusts the brightness and contrast of a imaG image.

Syntax: | imaG.Brightness brightness , contrast
brightness (integer) | The factor by which to increase or decrease the brightness of the image; use 0 to turn the image black, 100 to turn the image white, 50 to cause no change, and so on
contrast (integer) | OPTIONAL : The factor by which to increase or decrease the contrast of the image; use 0 for no contrast, 100 for maximum, 50 to cause no change, and so on.

If the imaG contains a palettized image, then the palette is adjusted.

If MODE PROPERTY is NOT caModeDraw then an ERROR will be thrown.

See also Contrast , Gamma , Filter , GrayScale